--[[
    @desc: 
    author:{zcg}
    time:2019-07-23 22:07:42
    {paramdesc}
    @return:
]]
function ReloadFile(module_name)
    if package.loaded[module_name] then
        local strArray = splitStr(module_name, ".")
        local module = strArray[table.getn(strArray)]
       
        local old_module = _G[module]
        package.loaded[module_name] = nil
        require (module_name)
        if old_module ~= nil then
            local new_module = _G[module]
            for k, v in pairs(new_module) do
                old_module[k] = v
            end
            package.loaded[module_name] = old_module
        end
    end

    --[[ local strArray = splitStr(module_name, ".")
    local module = strArray[table.getn(strArray)]
    local old_module = _G[module]
    if old_module ~= nil then
        package.loaded[module_name] = nil
        require(module_name)
        local new_module = _G[module]
        if old_module ~= nil then
            for k, v in pairs(new_module) do
                old_module[k] = v
            end
            package.loaded[module_name] = old_module
        end
    end]]
end

function splitStr(str, delimeter)
    local find, sub, insert = string.find, string.sub, table.insert
    local res = {}
    local start, start_pos, end_pos = 1, 1, 1
    while true do
        start_pos, end_pos = find(str, delimeter, start, true)
        if not start_pos then
            break
        end
        insert(res, sub(str, start, start_pos - 1))
        start = end_pos + 1
    end
    insert(res, sub(str, start))
    return res
end
